package com.minimalist.basic.config.bucket;

/**
 * @author 11987
 */

import io.github.bucket4j.Bandwidth;
import io.github.bucket4j.Bucket;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.time.Duration;

@Configuration
public class BucketConfig {

    @Bean
    public Bucket bucket() {
        Bandwidth limit = Bandwidth.builder().capacity(100)
                .refillIntervally(50, Duration.ofMinutes(1)).build();
        return Bucket.builder().addLimit(limit).build();
    }
}
